﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="AnyOffice.general.file_folder.edit" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="AnyOffice.DAL" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title id="litTitle" runat="server">Office 文档在线编辑</title>
		<SCRIPT type="text/javascript" LANGUAGE="JavaScript" src="/module/oc/ntkoocx.js"></SCRIPT>
		<style type="text/css"> BUTTON.op { BORDER-RIGHT: #eeeeee 1px solid; BORDER-TOP: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; WIDTH: 120px; CURSOR: hand; BORDER-BOTTOM: #eeeeee 1px solid; BACKGROUND-COLOR: #9dc2db } </style>
		<script>
function myload()
{
	TANGER_OCX_SetInfo();
	TANGER_OCX_OpenDoc('<%=url%>');		
}

function SelSign()
{
   var SelSign=document.getElementById("SelSign");
   if(SelSign.style.display=="")
      SelSign.style.display="none";
   else
      SelSign.style.display="";
}

//保留痕迹
function MY_SetMarkModify(flag)
{
  TANGER_OCX_SetMarkModify(flag);
  /*
  if(flag)
  {
     mflag1.style.fontWeight="bold";
     mflag2.style.fontWeight="";
  }
  else
  {
     mflag1.style.fontWeight="";
     mflag2.style.fontWeight="bold";
  }
  */
  TANGER_OCX_OBJ.focus();
}

//显示痕迹
function MY_ShowRevisions(flag)
{
  TANGER_OCX_ShowRevisions(flag);
  if(flag)
  {
     sflag1.style.fontWeight="bold";
     sflag2.style.fontWeight="";
  }
  else
  {
     sflag1.style.fontWeight="";
     sflag2.style.fontWeight="bold";
  }
}

function MyAddSign()
{
	var sltSign = document.getElementById("sltSign");
	if(sltSign != null)
	{
		if(sltSign.length == 1)
		{
			alert("系统未定义印章！");
			return false;
		}
		
		if(sltSign.value == "")
		{
			alert("请选择您要加盖的电子印章！");
			return false;			
		}
		
		AddSignFromURL(sltSign.value);
		return true;
	}
}
</script>
	</HEAD>
	<body class="bodycolor" leftmargin="0" topmargin="5" onLoad="myload();" onUnload="javascript:close_doc()">
		<form id="myForm" method="post" ENCTYPE="multipart/form-data" action="uploaddisk.aspx">
			<table width=100% height=100% class="small" cellspacing="1" cellpadding="3" align="center">
				<tr width="100%">
					<td valign="top" width="80">
						<table width="100%" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
							<TBODY>
							    <TR class="TableHeader">
                                    <TD noWrap align="middle">文件操作</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="TANGER_OCX_SaveEditToServerDisk(0);">
                                    <TD noWrap align="middle">保存文件</TD>
                                </TR>
                                
                                <TR class="" style="CURSOR: hand" onClick="TANGER_OCX_SaveEditToServerDisk(1);">
                                    <TD noWrap align="middle">保存并关闭</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="TANGER_OCX_ChgLayout();">
                                    <TD noWrap align="middle">页面设置</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="TANGER_OCX_PrintDoc();">
                                    <TD noWrap align="middle">打印</TD>
                                </TR>
                                <%if (isword == true)
                                  { %>
                                <TR class="TableHeader">
                                    <TD noWrap align="middle">文件编辑</TD>
                                </TR>
                                <!--
                                <TR style="CURSOR: hand" onclick="MY_SetMarkModify(true);">
                                    <TD id="mflag1" style="FONT-WEIGHT: bold" noWrap align="middle">保留痕迹</TD>
                                </TR>
                                <TR style="CURSOR: hand" onclick="MY_SetMarkModify(false);">
                                    <TD id="mflag2" noWrap align="middle">不留痕迹</TD>
                                </TR>
                                -->
                                <TR class="" style="CURSOR: hand" onClick="MY_ShowRevisions(true);">
                                    <TD id="sflag1" style="FONT-WEIGHT: bold" noWrap align="middle">显示痕迹</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="MY_ShowRevisions(false);">
                                    <TD id="sflag2" noWrap align="middle">隐藏痕迹</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="TANGER_OCX_AddDocHeader('某某政府机关红头文件')">
                                    <TD noWrap align="middle">文件套红</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="AddPictureFromLocal();">
                                    <TD noWrap align="middle">插入图片</TD>
                                </TR>
                                <% }%>
                                
                                <%if (isppt == false){ %>
                                <TR class="TableHeader">
                                    <TD noWrap align="middle">电子认证</TD>
                                </TR>
                                <TR class="" style="CURSOR: hand" onClick="DoCheckSign();">
                                    <TD noWrap align="middle">验证签名及印章</TD>
                                </TR>
                                   
                                    <TR class="" style="CURSOR: hand" onClick="DoHandSign2();">
                                        <TD noWrap align="middle">全屏手写签名</TD>
                                    </TR>
                                    <TR class="" style="CURSOR: hand" onClick="DoHandDraw2();">
                                        <TD noWrap align="middle">全屏手工绘图</TD>
                                    </TR>
                                    <TR style="CURSOR: hand" onClick="DoHandSign();">
                                        <TD noWrap align="middle">插入手写签名</TD>
                                    </TR>
                                    <TR style="CURSOR: hand" onClick="DoHandDraw();">
                                        <TD noWrap align="middle">插入手工绘图</TD>
                                    </TR>
                                    <TR style="CURSOR: hand" onClick="AddSignFromLocal()">
                                        <TD noWrap align="middle" title="加盖电子印章">加盖电子印章</TD>
                                    </TR>
                                    <TR style="CURSOR: hand" onClick="SelSign()">
                                    <TD noWrap align="middle" title="加盖电子印章(从服务器)">加盖电子印章<br>(从服务器)</TD>
						            </TR>
                                    <%
                                        FlowSignDao daoSign = new FlowSignDao();
                                        DataTable dtbSign = daoSign.SelectAll(this.Conn);
                                        if (dtbSign.Rows.Count > 0)
                                        {%>
                                            <TR style="display:none" id="SelSign">
                                            <TD noWrap align="middle">
                                            <select id="sltSign" class="SmallSelect"><option value="">选择印章</option>
                                            <%
                                            //印章列表
                                            for (int i = 0; i < dtbSign.Rows.Count; i++)
                                            {%>
                                                <option value="/module/oc/sign_<%=dtbSign.Rows[i]["SignId"].ToString()%>.esp"><%=dtbSign.Rows[i]["SignName"].ToString()%></option>;
                                            <%}%>
                                            </select><br>
                                            <input type="button" class="SmallButton" value="加盖印章" onClick="MyAddSign()">
                                            </TD>
                                            </TR>
                                         <%}else{%>
                                            <TR style="display:none" id="SelSign">
                                                <TD noWrap align="middle"><select id="sltSign"><option value="">未定义印章</option></select></TD>
                                            </TR>
                                         <%}%>
                                    <%} %>                               
												
							</TBODY>
						</TABLE>
					</td>
					<td width="100%">
						<OBJECT id="TANGER_OCX" codeBase="/lib/ntko/officecontrol.cab#version=4,0,0,7" height="100%" width="100%"
							classid="clsid:C9BC4DFF-4248-4a3c-8A49-63A7D317F404" VIEWASTEXT>
							<param name="MakerCaption" value="北京思道图强科技有限公司">
                            <param name="MakerKey" value="24A5746461573FC9E037B4880244598A7AD894E3">
                           <param name="ProductCaption" value="思道科技 www.anyoffice.net">
                            <param name="ProductKey" value="6FD48B0A725F0A9984AA28D46952725DD7481D1E">
							<PARAM NAME="_ExtentX" VALUE="18071">
							<PARAM NAME="_ExtentY" VALUE="20981">
							<PARAM NAME="BorderColor" VALUE="14402205">
							<PARAM NAME="BackColor" VALUE="-2147483643">
							<PARAM NAME="ForeColor" VALUE="-2147483640">
							<PARAM NAME="TitlebarColor" VALUE="14402205">
							<PARAM NAME="TitlebarTextColor" VALUE="0">
							<PARAM NAME="BorderStyle" VALUE="1">
							<PARAM NAME="Titlebar" VALUE="1">
							<PARAM NAME="Toolbars" VALUE="1">
							<PARAM NAME="Caption" VALUE="Office文档在线编辑">
							<PARAM NAME="IsShowToolMenu" VALUE="1">
							<PARAM NAME="IsNoCopy" VALUE="0">
							<PARAM NAME="IsHiddenOpenURL" VALUE="0">
							<PARAM NAME="MaxUploadSize" VALUE="0">
							<PARAM NAME="Menubar" VALUE="1">
							<PARAM NAME="Statusbar" VALUE="1">
							<PARAM NAME="FileNew" VALUE="0">
							<PARAM NAME="FileOpen" VALUE="0">
							<PARAM NAME="FileClose" VALUE="-1">
							<PARAM NAME="FileSave" VALUE="0">
							<PARAM NAME="FileSaveAs" VALUE="0">
							<PARAM NAME="FilePrint" VALUE="-1">
							<PARAM NAME="FilePrintPreview" VALUE="-1">
							<PARAM NAME="FilePageSetup" VALUE="-1">
							<PARAM NAME="FileProperties" VALUE="-1">
							<PARAM NAME="IsStrictNoCopy" VALUE="0">
							<PARAM NAME="IsUseUTF8URL" VALUE="0">
							<PARAM NAME="MenubarColor" VALUE="-2147483643">
							<PARAM NAME="IsUseControlAgent" VALUE="0">
							<PARAM NAME="IsUseUTF8Data" VALUE="0">
							<PARAM NAME="IsSaveDocExtention" VALUE="0">
							<PARAM NAME="IsDirectConnect" VALUE="0">
							<PARAM NAME="SignCursorType" VALUE="0">
							<PARAM NAME="IsResetToolbarsOnOpen" VALUE="0">
							<PARAM NAME="IsSaveDataIfHasVDS" VALUE="0">
							<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN>
						</OBJECT>
						<!-- OnDocumentClosed and OnDocumentOpened -->
						<script language="JScript" for="TANGER_OCX" event="OnDocumentClosed()">
						TANGER_OCX_OnDocumentClosed();
						</script>						
						<script language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj)">
						TANGER_OCX_OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);
						if("<% =isword %>" == "True")
						{
							MY_SetMarkModify(true);//进入痕迹保留状态
							MY_ShowRevisions(true);//显示痕迹保留						
						}
						</script>
						<script language="JScript" for="TANGER_OCX" event="AfterOpenFromURL(doc)">
						//该事件在BeginOpenFromURL方法执行完毕之后被触发。
						</script>
						<script language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled)">
						if (cmd == 3) //user has clicked on file save menu or button
						{
							//save to server
							//cancel default process
							//TANGER_OCX_SaveEditToServerDisk();
							//document.all("TANGER_OCX").CancelLastCommand = true;
						}
						</script>
						<script language="JScript" for="TANGER_OCX" event="OnSignSelect(issign,signinfo)">
						if(issign)
						{
								TANGER_OCX_OBJ.SetReadOnly(true);
								TANGER_OCX_OBJ.SetReadOnly(false);
						}
						else
						{
						}
						</script>
						<script language="JScript">
						var close_op_flag=0;
						function close_doc()
						{
						   if(TANGER_OCX_op == "1")
						   {
						    try
						    {
							    document.all("TANGER_OCX").setAttribute("IsNoCopy",false);
							    if(close_op_flag!=1)
							    {
								    msg='是否保存对  \'<%=_filename%>\'  的修改？';
								    if(window.confirm(msg))
									    TANGER_OCX_SaveEditToServerDisk(0);
							    }
							}
							catch(err){};
						   }
						}
						</script>
					</td>
				</tr>
			</table>
			<!-- TANGER_OCX_op 1编辑,0阅读-->
			<INPUT type="hidden" name="TANGER_OCX_op" value="1">
			<INPUT type="hidden" name="TANGER_OCX_attachid" value="">
			<INPUT TYPE="hidden" name="TANGER_OCX_attachmentid" value="<%=_path%>">
			<INPUT TYPE="hidden" name="TANGER_OCX_filename" value="<%=_filename%>">
			<INPUT TYPE="hidden" name="TANGER_OCX_username" value="<%=_username%>">			
		</form>
		<%=_filename%>
		
	</body>
</HTML>